
* +++++++++++++++++++++++++++++
* RUN ALL DO-FILES 
* FOR REGIONAL ANALYSIS
* +++++++++++++++++++++++++++++

* globals 
global root ".."
global data_raw "${root}/replication_regional_data/raw/"
global data_derived "${root}/replication_regional_data/derived/"
global code "${root}/Replication/regional analysis/code"

global output "${root}/results_regional_analysis/"
cap mkdir "${output}"

* build regional analysis data
* +++++++++++++++

* clean population count data
do "${code}/clean_population_data.do"

* clean data on apprenticeships 
do "${code}/clean_apprenticeship_data.do"

* clean data on local labor market statistics
do "${code}/clean_labor_market_stats.do"

* clean data on integration courses
do "${code}/clean_integration_course_stat.do"

* clean data on ProAsyl groups
do "${code}/clean_pro_asyl_groups.do"

* clean data on crime
do "${code}/clean_crime_reports.do"

* clean elections data from 2019 + 2014
do "${code}/clean_elections_data.do"

* clean data on local economu
do "${code}/clean_econ_vars.do"

* clean data on urbanity
do "${code}/clean_urban_rural.do"

* build crosswalk old ags codes to new ones
do "${code}/cw_ags_old_new.do"

* clean data on religiosity
do "${code}/clean_religion.do"

* build crosswalk postal codes (plz) to county (kreis)
do "${code}/cw_krs_plz.do"

* clean data on integration sports clubs
do "${code}/clean_sports_clubs.do"

* clean data on local teacher unemployment
do "${code}/clean_unemployed_teachers.do"

* clean migration matrix
do "${code}/clean_migration_matrix.do"

* combine individual covariates and build 
* dataset used for regional analyses
do "${code}/combine_regional_data.do"

* run analysis scripts
* +++++++++++++++

* Table 6: County-level Multivariate Relationships with Friending Integration
do "${code}/table_6.do"

* Table 7 + 8: 
* Table 7: Integration Courses and Teacher Unemployment Rates
* Table 8: IV Estimates - Measures of Integration and Integration Courses
do "${code}/table_7_8.do"

* Figure A8: Comparing Regional Estimates of Integration - Facebook vs. SOEP
do "${code}/figure_a8.do"

* Figure A11: Comparing Movers in Facebook and Administrative Data
do "${code}/figure_a11.do"

* Figure A11: County-Level Univariate Correlations with Friending Integration - Long Version
do "${code}/figure_a18.do"

* Table A13: Comparison Königsteiner Key and Assignment of Refugees to Place
do "${code}/table_a13.do"

